import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useUserStore = defineStore('user', () => {
	// state
	const token = ref('')

	// action
	const setToken = (value : string) => {
		token.value = value
	}

	return {
		token,
		setToken
	}
}, {
	persist: {
		storage: {
			setItem(key, value) {
				uni.setStorageSync(key, value)
			},
			getItem(key) {
				return uni.getStorageSync(key)
			}
		}
	}
})